<?php
/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link      http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
 * @license   http://framework.zend.com/license/new-bsd New BSD License
 */

return array(
    'controllers' => array(
    		'invokables' => array(
    				'Application\Controller\User' => 'Application\Controller\UserController',
    				'Application\Controller\Home' => 'Application\Controller\HomeController',
    				'Application\Controller\Testa' => 'Application\Controller\TestaController',
    				'Application\Controller\Friend' => 'Application\Controller\FriendController',
    				'Application\Controller\Main' => 'Application\Controller\MainController',
    				//'Application\Controller\Album' => 'Application\Controller\AlbumController',
    		        //'Application\Controller\Photo' => 'Application\Controller\PhotoController',
    		        //'Application\Controller\Video' => 'Application\Controller\VideoController',
    		        'Application\Controller\Comment' => 'Application\Controller\CommentController',
    		),
    ),
      'controller_plugins' => array(
          'invokables' => array(
              'fileUploader' => 'Application\Controller\Plugin\FileUploader',
              'defaultFileUploader' => 'Application\Controller\Plugin\DefaultFileUploader',
              'imageUploader' => 'Application\Controller\Plugin\ImageUploader',
              'videoUploader' => 'Application\Controller\Plugin\VideoUploader',
          ),
      ),
    'router' => array(
        'routes' => array(
            'index' => array(
                'type' => 'Zend\Mvc\Router\Http\Literal',
                'options' => array(
                    'route'    => '/', 
                    'constraints' => array(
                    		'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
                    		'id'     => '[0-9]+',
                    ),
                    'defaults' => array(
                        'controller' => 'Application\Controller\Home',
                        'action'     => 'index',
                    ),
                ),
            ),
            // The following is a route to simplify getting started creating
            // new controllers and actions without needing to create a new
            // module. Simply drop new controllers in, and you can access them
            // using the path /application/:controller/:action
            'application' => array(
                'type'    => 'Literal',
                'options' => array(
                    'route'    => '/application',
                    'defaults' => array(
                        '__NAMESPACE__' => 'Application\Controller',
                        'controller'    => 'Home',
                        'action'        => 'index',
                    ),
                ),
                'may_terminate' => true,
                'child_routes' => array(
                    'default' => array(
                        'type'    => 'Segment',
                        'options' => array(
                            'route'    => '/[:controller[/:action]]',
                            'constraints' => array(
                                'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
                                'action'     => '[a-zA-Z][a-zA-Z0-9_-]*',
                            ),
                            'defaults' => array(
                            ),
                        ),
                    ),
                ),
            ),
            'home' => array(
            		'type'    => 'segment',
            		'options' => array(
            				'route'    => '/home[/][:action][/:id]',
            				'constraints' => array(
            						'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
            						'id'     => '[0-9]+',
            				),
            				'defaults' => array(
            						'controller' => 'Application\Controller\Home',
            						'action'     => 'index',
            				),
            		),
            ),
            'testa' => array(
            		'type'    => 'segment',
            		'options' => array(
            				'route'    => '/testa[/][:action][/:id]',
            				'constraints' => array(
            						'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
            						'id'     => '[0-9]+',
            				),
            				'defaults' => array(
            						'controller' => 'Application\Controller\Testa',
            						'action'     => 'index',
            				),
            		),
            ),
            'friend' => array(
            		'type'    => 'segment',
            		'options' => array(
            				'route'    => '/friend[/][:action][/:id][/:offset][/:limit]',
            				'constraints' => array(
            						'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
            						'id'     => '[0-9]+',
            						'offset'     => '[0-9]+',
            						'limit'     => '[0-9]+',
            				),
            				'defaults' => array(
            						'controller' => 'Application\Controller\Friend',
            						'action'     => 'index',
            						'id'     => '0',
            						'offset'     => '0',
            						'limit'     => '0',
            				),
            		),
            ),
            'user' => array(
            		'type'    => 'segment',
            		'options' => array(
            				'route'    => '/user[/][:action][/:id]',
            				'constraints' => array(
            						'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
            						'id'     => '[a-zA-Z0-9.@_-]*',
            				),
            				'defaults' => array(
            						'controller' => 'Application\Controller\User',
            						'action'     => 'index',
            				),
            		),
            ),
            'main' => array(
            		'type'    => 'segment',
            		'options' => array(
            				'route'    => '/main[/][:action][/:id]',
            				'constraints' => array(
            						'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
            						'id'     => '[0-9]+',
            				),
            				'defaults' => array(
            						'controller' => 'Application\Controller\Main',
            						'action'     => 'index',
            				),
            		),
            ),
            'comment' => array(
            		'type'    => 'segment',
            		'options' => array(
            				'route'    => '/comment[/][:action][/:id]',
            				'constraints' => array(
            						'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
            						'id'     => '[0-9]+',
            				),
            				'defaults' => array(
            						'controller' => 'Application\Controller\Comment',
            						'action'     => 'index',
            				),
            		),
            ),
        ),
    ),
    'service_manager' => array(
        'factories' => array(
            'translator' => 'Zend\I18n\Translator\TranslatorServiceFactory',
        ),
    ),
    'translator' => array(
        'locale' => 'en_US',
        'translation_file_patterns' => array(
            array(
                'type'     => 'gettext',
                'base_dir' => __DIR__ . '/../language',
                'pattern'  => '%s.mo',
            ),
        ),
    ),
    'view_manager' => array(
        'display_not_found_reason' => true,
        'display_exceptions'       => true,
        'doctype'                  => 'HTML5',
        'not_found_template'       => 'error/404',
        'exception_template'       => 'error/index',
        'template_map' => array(
            'layout/layout'           => __DIR__ . '/../view/layout/layout.phtml',
            'application/home/index' => __DIR__ . '/../view/application/home/index.phtml',
            'application/home/fblogin' => __DIR__ . '/../view/application/home/home.phtml',
            'application/queue/index' => __DIR__ . '/../view/application/queue/index.phtml',
            'application/user/signon' => __DIR__ . '/../view/application/user/signon.phtml',
            'application/user/validate' => __DIR__ . '/../view/application/user/confirm.phtml',
            'application/user/forgotpassword' => __DIR__ . '/../view/application/user/forgotpassword.phtml',
            'application/user/newpassword' => __DIR__ . '/../view/application/user/newpassword.phtml',
            'application/user/confirm' => __DIR__ . '/../view/application/user/confirm.phtml',
            'application/user/profil' => __DIR__ . '/../view/application/user/profile.phtml',
            'application/user/edit' => __DIR__ . '/../view/application/user/edit.phtml',
            'error/404'               => __DIR__ . '/../view/error/404.phtml',
            'error/index'             => __DIR__ . '/../view/error/index.phtml',
        ),
        'template_path_stack' => array(
            __DIR__ . '/../view',
        ),
        'strategies' => array(
        		'ViewJsonStrategy', // register JSON renderer strategy
        ),
    ),
    'doctrine' => array(
    		'driver' => array(
    				'Application_driver' => array(
    						'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
    						'cache' => 'array',
    						'paths' => array(__DIR__ . '/../src/Application/Entity')
    				),
    				'orm_default' => array(
    						'drivers' => array(
    								'Application\Entity' =>'Application_driver'
    						)
    				),
    				'orm_social' => array(
    						'drivers' => array(
    								'Application\Entity' => 'Application_driver'
    						)
    				)
    		),
    		'authentication' => array(
    				'orm_default' => array(
    						'object_manager' => 'Doctrine\ORM\EntityManager',
    						'identity_class' => 'Application\Entity\User',
    						'identity_property' => 'email',
    						'credential_property' => 'password',
    						'credential_callable' => function ($user, $password) {
    						  return (($user->password === $password)&&($user->confirm));
    		                  //return ($user->password === md5($password));
    						}
    				),
    				'orm_confirm' => array(
    						'object_manager' => 'Doctrine\ORM\EntityManager',
    						'identity_class' => 'Application\Entity\User',
    						'identity_property' => 'email',
    						'credential_property' => 'password',
        				    'credential_callable' => function ($user, $password) {
        				    	return ($user->password === $password);
        				    }
    				),
    		),
    ),
'module_config' => array(
        'upload_location' =>  __DIR__ . '/../../../data/uploads',
        'upload_folder' => 'uploads',
        'images_location' =>  __DIR__ . '/../../../public/photos',
        'images_folder' => 'images',
        'videos_location' =>  __DIR__ . '/../../../public/videos',
        'videos_folder' => 'videos',
    ),
);
